package com.group7.mall.resp;

import lombok.Data;

import java.util.Collections;
import java.util.List;

@Data
public class MessagePageResponse<T> {

    private Long pageSize = 20L;

    private Long total = 0L;

    private List<T> result = Collections.emptyList();

    public void setRecords(List<T> result) {
        this.result = result;
        if(result != null && result.size() > 0 && this.total == 0) {
            setTotal((long) result.size());
        }
    }
}
